/*
 * @Author: Kang
 * @Date: 2022-02-11 23:14:39
 * @Last Modified by: Kang
 * @LastEditTime: 2022-06-26 21:07:28
 */
module.exports = app => {
    class LoginService extends app.Service {

        //用户登录
        * getUserByName(data) {
            try {
                const userInfo = yield this.ctx.model.User.findOne({ where: { username: data } });
                console.log('userInfo', userInfo)
                if (userInfo == null)
                    return userInfo
                return userInfo.toJSON()
            } catch (error) {
                throw new Error(error);
            }
        }
    }
    return LoginService;
}